'''
装饰器、生成器
'''

# 1.有参装饰器
def add_v(char, value):
    def wrapper(fn):
        def test(*args, **kwargs):
            re = fn(*args, **kwargs)
            if type(re) == int:
                if char == '+':
                    return re + value
                else:
                    return re - value
            return re

        return test

    return wrapper


@add_v('-', 100)
def sum1(x, y):
    return x + y


print(sum1(20, 30))
# print(sum1('a', 'c'))
